<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    #outer {
        width: 500px;
        height: 300px;
        background-color: aqua;
    }
    
    #middle {
        width: 400px;
        height: 200px;
        background-color: rgb(136, 255, 0);
    }
    
    #inner {
        width: 300px;
        height: 100px;
        background-color: rgb(181, 54, 192);
    }
</style>

<body>
    <div id="outer">
        <div id="middle">
            <div id="inner">点击这里</div>
        </div>
    </div>

    <script>
        let inner = document.getElementById('inner');
        let middle = document.getElementById('middle');
        let outer = document.getElementById('outer');

        // 捕获阶段监听
        outer.addEventListener('click', function(e) {
            console.log('捕获阶段');
        }, true);
        // 冒泡阶段监听
        middle.addEventListener('click', function(e) {
            console.log('冒泡阶段');
        }, false);
    </script>
</body>

</html>